﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <style type="text/css">
        body
        {
            color: InactiveCaptionText;
        }
        h2
        {
            font-size: 120%;
            color: CaptionText;
        }
    </style>
</head>
<body>
    <h2>
        Using anonymous types</h2>
    <p>
        Another way of expressing the properties of an object literal is by passing an object,
        of which the public properties are found using reflection.</p>
    <p>
        This is particularly useful to pass an object of an anonymous type.</p>
    <p>
        Note how the property name 'function' (a reserved word in JavaScript) is correctly
        quoted.</p>
    <h2>
        Source:</h2>
    <style type="text/css">
        .cf
        {
            font-family: Courier New;
            font-size: 10pt;
            color: black;
            background: white;
        }
        .cl
        {
            margin: 0px;
        }
        .cb1
        {
            color: blue;
        }
        .cb2
        {
            color: #2b91af;
        }
        .cb3
        {
            color: #a31515;
        }
    </style>
    <div class="cf">
        <p class="cl">
            <span class="cb1">var</span> obj = <span class="cb2">JS</span>.Object(<span class="cb1">new</span>
            {name = <span class="cb3">&quot;Dave&quot;</span>, function = <span class="cb3">&quot;Developer&quot;</span>});</p>
        <p class="cl">
            <span class="cb1">return</span> obj.ToString();</p>
    </div>
</body>
</html>
